home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_xfig.idb / usr / freeware / src / xfig / transfig.3.1.2 / fig2dev / strstr.c.z / strstr.c
Encoding:
C/C++ Source or Header  |  1997-09-09  |  1.7 KB  |  47 lines

  1. /*
  2.  * TransFig: Facility for Translating Fig code
  3.  * Copyright (c) 1985 Supoj Sutantavibul
  4.  * Copyright (c) 1991 Micah Beck
  5.  *
  6.  * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  7.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  8.  * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  9.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  10.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  11.  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  12.  * PERFORMANCE OF THIS SOFTWARE.
  13.  *
  14.  * The X Consortium, and any party obtaining a copy of these files from
  15.  * the X Consortium, directly or indirectly, is granted, free of charge, a
  16.  * full and unrestricted irrevocable, world-wide, paid up, royalty-free,
  17.  * nonexclusive right and license to deal in this software and
  18.  * documentation files (the "Software"), including without limitation the
  19.  * rights to use, copy, modify, merge, publish, distribute, sublicense,
  20.  * and/or sell copies of the Software, and to permit persons who receive
  21.  * copies from any such party to do so, with the only requirement being
  22.  * that this copyright notice remain intact.  This license includes without
  23.  * limitation a license to do the foregoing actions under any patents of
  24.  * the party supplying this software to the X Consortium.
  25.  */
  26.  
  27. #ifdef NOSTRSTR
  28. /*
  29.  * Find the first occurrence of s2 in s1.
  30.  */
  31. char *
  32. strstr(s1, s2)
  33.     register char *s1, *s2;
  34. {
  35.     register int i, len, n;
  36.  
  37.     if (s2[0] == '\0')
  38.         return(s1);
  39.     len = strlen(s2);
  40.     n = strlen(s1) - len;
  41.     for (i = 0; i <= n; i++)
  42.         if (strcmp(s1 + i, s2) == 0)
  43.             return(s1 + i);
  44.     return(NULL);
  45. }
  46. #endif
  47.